import java.math.BigDecimal;




/**
 * 
 * @author Nizar
 * 
 */


public class ExprSeq extends Expr {

	Expr[] seq;

	public ExprSeq(Expr... seq) {
		if (seq.length == 0)
			throw new RuntimeException("Nessuna espressione trovata");
		this.seq = seq;
	}

	@Override
	public BigDecimal evaluate(Env env) {
		for (int i = 0; i < seq.length - 1; i++) {

			seq[i].evaluate(env);
		}

		return seq[seq.length - 1].evaluate(env);
	}

	public static ExprSeq _(Expr... seq){
		return new ExprSeq(seq);
	}

	@Override
	public String toString() {
		String exprSeqTmp = "";
		
		for (int i = 0; i < seq.length; i++) {
			exprSeqTmp = exprSeqTmp + (seq[i]+";");
			exprSeqTmp= exprSeqTmp +"\n";
		}
		
		return exprSeqTmp;
	}

	@Override
	public boolean isUnExpr() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isAssignExpr() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isPlusBinExpr() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isMinusBinExpr() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isTimesBinExpr() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isDivideBinExpr() {
		// TODO Auto-generated method stub
		return false;
	}


	@Override
	public boolean isNum() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isId() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isSeqExpr() {
		// TODO Auto-generated method stub
		return true;
	}

}
